<?php
	if(!isset($_SESSION['member_is_admin']) || $_SESSION['member_is_admin'] == ''){
		header("Location: index.php");
	}
	
	//--
	$xtpl_main->assign ( "page_title", "Member" );
	
	//-- Delete a member
	if(isset($_GET['del_member_id'])){
		mysql_query("UPDATE member SET member_status = '0' WHERE member_id = '".$_GET['del_member_id']."'");
		header("Location: ?mod=admin&act=member");
	}
	
	//-- List all member
	$resultListAdminMember = mysql_query("SELECT * FROM member ORDER BY member_username");
	$iCountAdminMember = 0;
	while($rowListAdminMember = mysql_fetch_array($resultListAdminMember)){
		$iCountAdminMember++;
		$rowListAdminMember['iCountAdminMember'] = $iCountAdminMember;
		
		//--
		if($rowListAdminMember['member_status'] == '1'){
			$rowListAdminMember['member_status'] = 'active';
		}else{
			$rowListAdminMember['member_status'] = 'inactive';
		}
		
		//-- Link edit
		$rowListAdminMember['member_edit_link'] = '?mod=admin&act=member-task&member_id='.$rowListAdminMember['member_id'];
		
		//--
		$xtpl->assign('list_admin_member', $rowListAdminMember);
		$xtpl->parse('center.list_admin_member');
	}
?>